﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site2.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<DTO.Models.MEDIA>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Banner
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <div class="dung-section">
        <div class=" dung-section-title"> <%= ConfigurationManager.AppSettings[ViewData["TypeMediaName"].ToString()] %></div>
        <div class="dung-section-content">
            <table width="100%" class="dung-table">
			    <tr>
                    <th width="20%">Tư vấn</th>
				    <th width="30%">Nội dung</th>
				    <th width="35%">Hình ảnh</th>
				    <th width="15%">Công cụ</th>
			    </tr>
			    <tbody>
                <% foreach (var item in Model) { %>
                    <% using (Html.BeginForm("Intro", "Media", FormMethod.Post, new { id = "frmMedia", enctype = "multipart/form-data" }))
                    {%>
                        <tr>
                            <td>
                                <%= ConfigurationManager.AppSettings[item.TypeMediaName.Substring(5,6)]%>
                            </td>       
                            <td>
                                <textarea name="Intro" cols="50" rows="3"><%= item.Intro %></textarea>
                            </td>
                            <td>
                                <img src='<%= Url.Content("~/MediaImage/" + item.ID + ".jpg") %>' width="357" height="192" alt="" />
                                
                                <br/>
                                <p style="">
						            <input type="button" class="dung-button" value="Chọn hình" onclick="showuploadimage('<%= item.ID %>')" />
					            </p>
                                <p id="selectimage<%= item.ID %>" style="display:none">
                                    <input id="file<%= item.ID %>" type="file" name="file" />
                                    <br/>
                                    <input type="button" class="dung-button" value="Bỏ chọn" onclick="unselectimage('<%= item.ID %>')" />
                                </p>
                            </td>
                            <td>
                                <input name="TypeMediaName" type="hidden" value="<%= item.TypeMediaName %>" />
                                <input name="ID" type="hidden" value="<%= item.ID %>" />
                                <input name="MediaID" type="hidden" value="<%= item.MediaID %>" />
                                <input type="submit" class="dung-button" value="Cập nhật" />
                            </td>
                        </tr>
                    <%} %>    
                <%} %>
                
			    </tbody>
		    </table>
            
        </div>
		<div class="clearer">&nbsp;</div>
	</div>

    <script type="text/javascript">
        function showuploadimage(id) {
            $("#selectimage" + id).toggle('slow');
        }

        function unselectimage(id) {
            $("#file" + id).val("");
            $("#selectimage" + id).toggle('slow');
        }

    </script>
</asp:Content>
